import 'user_model.dart';

class Student extends User {
  final String idCardNumber;
  final String? email;
  final String? avatar;
  final String? assignedExamId; // 分配给学生的考试ID

  Student({
    required String id,
    required String name,
    required this.idCardNumber,
    this.email,
    this.avatar,
    this.assignedExamId,
  }) : super(id: id, name: name, role: 'student');

  factory Student.fromJson(Map<String, dynamic> json) {
    return Student(
      id: json['id'],
      name: json['name'],
      idCardNumber: json['idCardNumber'],
      email: json['email'],
      avatar: json['avatar'],
      assignedExamId: json['assignedExamId'],
    );
  }

  @override
  Map<String, dynamic> toJson() {
    final map = super.toJson();
    map.addAll({
      'idCardNumber': idCardNumber,
      'email': email,
      'avatar': avatar,
      'assignedExamId': assignedExamId,
    });
    return map;
  }

  @override
  String toString() {
    return 'Student{id: $id, name: $name, idCardNumber: $idCardNumber, email: $email}';
  }
} 